# -*- coding: utf-8 -*-
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy import Column, Integer, String, Date, Float, Boolean,DateTime
from sqlalchemy.ext.declarative import declarative_base

class sql_main():
    def __init__(self):
        self.engine = None
        self.session = None
        self.Base = declarative_base()

    def login_mode(self,mode=0):
        if mode == 0:
            self.engine = create_engine(f'sqlite:///file/{1}.db')
        elif mode == 1:
            self.engine = create_engine('sqlite:///example.db')
        else:
            pass
        # 创建所有表
        self.Base.metadata.create_all(self.engine)
        # 创建会话工厂
        Session = sessionmaker(bind=self.engine)
        # 创建会话实例
        self.session = Session()
